<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * verify login - security
 * @author: Jose Palala
 * created: 08/25/202
 **/

class Scholars_db extends Model {

    public function __construct()
    {
		parent::__construct();
	}
    
    
	//verify loggedin scholar
	function is_scholar($username,$password)
    {
		//returns back true value (not empty)
		if(isset($_SESSION['username'])) {
			$username = $_SESSION['username'];
			return $username;
		}
        
    	$q1 = $this->db->where('username', $username)->where('password', $password)->limit(1)->get('sponsors');
    		
    	if ($q1->num_rows > 0) {
    		return $q1->row();
    	} else {
    	return false;
		
        }
    }
	//get affected rows
	public function getAffectedRows()
	{
		return $this->db->affected_rows();
	}

}
/*
	File: scholars_db
	A model for schoalrs_db login
*/